package com.zyh.javaseshuzujinjiekaoshi;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        changeArray();

    }
//逆转数组
    public static void changeArray() {
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个元素：");
            arr[i] = new Scanner(System.in).nextInt();
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
//        数组逆序
        for (int i = 0; i < arr.length; i++) {
            int temp = arr[i];
            arr[i] = arr[arr.length - (i + 1)];
            arr[arr.length - (i + 1)] = temp;
            if (i == arr.length / 2) {
                break;
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
